using System;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class ObjectLookCustomization
{
	[Serializable]
	public class MaterialCustomization
	{
		public string name;

		public List<Transform> objectsToCustomise = new List<Transform>();

		public List<string> namesOfObjectsToCustomize = new List<string>();

		public List<MaterialProperty> propertiesToChange = new List<MaterialProperty>();

		public void ApplyCustomization()
		{
			ApplyCustomization(objectsToCustomise);
		}

		public void ApplyCustomization(List<Transform> objectsToCustomise)
		{
			foreach (Transform item in objectsToCustomise)
			{
				Material material = item.GetComponent<Renderer>().material;
				foreach (MaterialProperty item2 in propertiesToChange)
				{
					item2.Apply(material);
				}
			}
		}
	}

	public enum MaterialPropertyType
	{
		TextureType = 0,
		FloatType = 1,
		ColorType = 2
	}

	[Serializable]
	public class MaterialProperty
	{
		public string propertyName;

		public MaterialPropertyType type;

		public string textureName;

		public float floatValue;

		public float minRange = -1000f;

		public float maxRange = 1000f;

		public Color colorValue;

		public bool showExtended;

		public void Apply(Material material)
		{
			switch (type)
			{
			case MaterialPropertyType.ColorType:
				material.SetColor(propertyName, colorValue);
				break;
			case MaterialPropertyType.FloatType:
				material.SetFloat(propertyName, floatValue);
				break;
			case MaterialPropertyType.TextureType:
				material.SetTexture(propertyName, Resources.Load<Texture>(textureName));
				break;
			}
		}
	}

	public string lookName;

	public List<MaterialCustomization> customizations = new List<MaterialCustomization>();
}
